package io.renren.modules.driver.service;

import io.renren.modules.driver.entity.SjDriverEntity;
import io.renren.modules.psorder.entity.PsOrderEntity;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 司机表
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2017-11-30 18:18:19
 */
public interface SjDriverService {
	
	SjDriverEntity queryObject(Long id);
	
	List<SjDriverEntity> queryList(Map<String, Object> map);
	
	int queryTotal(Map<String, Object> map);
	
	void save(SjDriverEntity sjDriver);
	
	void update(SjDriverEntity sjDriver);
	
	void delete(Long id);
	
	void deleteBatch(Long[] ids);

	SjDriverEntity queryObjectByUserName(String username);

	/**
	 * 司机完成订单
	 * @param psOrder 配送订单实体
	 * @param extraCharge  额外金额
	 * @param extraChargeNote 额外金额说明
	 */
	void completedPsOrder(PsOrderEntity psOrder, SjDriverEntity driver, BigDecimal extraCharge, String extraChargeNote);

	/**
	 * @param psOrder 配送订单对象
	 * @param driver 司机对象
	 */
	void receivePstOrder(PsOrderEntity psOrder,SjDriverEntity driver,String longitude, String latitude);

	/**
	 * @param psOrder 配送订单对象
	 * @param curLng 当前经度
	 * @param curLat 当前纬度
	 */
	void startCalculateMileage(PsOrderEntity psOrder,String curLng,String curLat);

	/**
	 * @param psOrder 配送订单对象
	 * @param driver  司机对象
	 */
	void cancelPsOrder(PsOrderEntity psOrder,SjDriverEntity driver);

	/**
	 * 卸货完毕，计算订单总金额
	 * @param psOrder 配送订单对象
	 * @param driver 司机对象
	 */
	PsOrderEntity completeUnloading(PsOrderEntity psOrder,SjDriverEntity driver);

	PsOrderEntity modifyTotalPrice(PsOrderEntity psOrder,BigDecimal extraCharge, String extraChargeNote);

	/**
	 * 司机发起收费
	 * @param psOrder 配送订单对象
	 */
	void goToCharge(PsOrderEntity psOrder);

	/**
	 * 司机确认已收到现金
	 * @param psOrder 配送订单对象
	 */
	void confirmCash(PsOrderEntity psOrder);

	void arriveStart(PsOrderEntity psOrder);

	void arriveEnd(PsOrderEntity psOrder);

	/**
	 * 查询用户收藏的司机列表
	 * @param userId 用户id
	 * @return
	 */
	List<SjDriverEntity> queryCollectedListByUserId(Long userId);

	Map<String,Object> queryMineInfo(Long driverId);

	/**
	 * @param psOrder 订单实体
	 * @param driver 司机实体
	 * @param psOrderRouteSections 订单多目的地参数
	 */
	void modifyDestination(PsOrderEntity psOrder,SjDriverEntity driver,String psOrderRouteSections);

	/**
	 * 查询分月统计司机收入接口
	 * @param driverId 司机id
	 * @return
	 */
	List<Map<String,Object>> queryIncomeGroupByMonth(Long driverId);

	/**
	 * 查询余额界面余额相关信息
	 * @param driverId 司机id
	 * @return
	 */
	Map<String,Object> queryBalanceInfo(Long driverId);

	/**
	 * 查询司机收入明细
	 * @param driverId 司机id
	 * @return
	 */
	List<Map<String,Object>> queryIncomeDetail(Long driverId);

	/**
	 * @param driverId 司机id
	 * @param month 月份 格式 "2018-03"
	 * @return
	 */
	Map<String,Object> queryIncomeByIuputMonth(Long driverId,String month);

	/**
	 * @param driverId 司机id
	 * @param month  月份 格式 "2018-03"
	 * @return
	 */
	List<Map<String,Object>> queryIncomeDetailByIuputMonth(Long driverId,String month);

	/**
	 * 司机到达第几个目的地(开始卸货)
	 * @param psOrder 订单模型
	 * @param arriveDesNum 目的地序号
	 */
	void arriveDesByNum( PsOrderEntity psOrder,Integer arriveDesNum);

	/**
	 *  司机从第几个目的地卸货完成(卸货完成开始出发)
	 * @param psOrder 订单模型
	 * @param arriveDesNum 目的地序号
	 */
	PsOrderEntity startDesByNum( PsOrderEntity psOrder,Integer arriveDesNum);

	/**
	 * 司机暂不收费
	 * @param psOrder 订单对象
	 */
	void zbsfy( PsOrderEntity psOrder);

	/**
	 * 实时更新司机位置(更新的是高德云,场景为开始接单但订单还没接到的情况)
	 * @param driver 司机实体
	 * @param longitude 纬度
	 * @param latitude 经度
	 * @param address 地址名称
	 * @return
	 */
	int realTimeLocation(SjDriverEntity driver,String longitude, String latitude, String address);

	/**
	 * 实时更新司机位置(场景为开始接单且订单已经接到的情况)
	 * @param driver 司机实体
	 * @param psOrder  订单实体
	 * @param longitude 纬度
	 * @param latitude 经度
	 * @param address 地址名称
	 */
	void realTimeLocationUpdatePsOrder(SjDriverEntity driver,PsOrderEntity psOrder,String longitude, String latitude, String address);



	/**
	 * 司机财务模块展示
     */
	List<SjDriverEntity> sjFinancelist(Map<String, Object> map);
	int sjFinancelistTotal(Map<String, Object> map);

}
